﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.OracleClient;

namespace SmartMD.DataAccess.Oracle.DaoImpl
{
    public class DBUtil
    {
        public static Boolean Delete(string sql)
        {

            XMLHelper xmlOper = new XMLHelper();
            String dataAccess = xmlOper.GetXmlNodeAttribute("SmartMD.Manager.vshost.exe.config", "configuration/appSettings/add[@key='DataAddress']", "value");
            if (dataAccess == null)
                return false;
            OleDbConnection conn = new OleDbConnection(dataAccess);
            conn.Open();
            try
            {
                if (conn == null)
                    return false;
                OleDbCommand oledbCom = new OleDbCommand(sql, conn);
                
                int d = oledbCom.ExecuteNonQuery();
                if (d < 1)
                    return false;
                return true;
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return false;
            }
            finally
            {
                conn.Close();
                conn = null;
            }
        }
    }
}
